<?php require_once('../Connections/agriculture.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_pickRecordset1 = 10;
$pageNum_pickRecordset1 = 0;
if (isset($_GET['pageNum_pickRecordset1'])) {
  $pageNum_pickRecordset1 = $_GET['pageNum_pickRecordset1'];
}
$startRow_pickRecordset1 = $pageNum_pickRecordset1 * $maxRows_pickRecordset1;

mysql_select_db($database_agriculture, $agriculture);
$query_pickRecordset1 = "SELECT * FROM pick";
$query_limit_pickRecordset1 = sprintf("%s LIMIT %d, %d", $query_pickRecordset1, $startRow_pickRecordset1, $maxRows_pickRecordset1);
$pickRecordset1 = mysql_query($query_limit_pickRecordset1, $agriculture) or die(mysql_error());
$row_pickRecordset1 = mysql_fetch_assoc($pickRecordset1);

if (isset($_GET['totalRows_pickRecordset1'])) {
  $totalRows_pickRecordset1 = $_GET['totalRows_pickRecordset1'];
} else {
  $all_pickRecordset1 = mysql_query($query_pickRecordset1);
  $totalRows_pickRecordset1 = mysql_num_rows($all_pickRecordset1);
}
$totalPages_pickRecordset1 = ceil($totalRows_pickRecordset1/$maxRows_pickRecordset1)-1;

$queryString_pickRecordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_pickRecordset1") == false && 
        stristr($param, "totalRows_pickRecordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_pickRecordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_pickRecordset1 = sprintf("&totalRows_pickRecordset1=%d%s", $totalRows_pickRecordset1, $queryString_pickRecordset1);
?>
<style type="text/css">
<!--
.STYLE1 {font-size: 14px}
-->
</style>
<table width="880" height="150" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td width="162"><table width="150" height="200" border="1" cellpadding="0" cellspacing="0">
      <tr>
        <td width="123"><div align="center"><a href="scaihou.php">查看信息</a></div></td>
      </tr>
      <tr>
        <td><div align="center"><a href="wcaihou.php">录入信息</a></div></td>
      </tr>
      <tr>
        <td><div align="center"><a href="drcaihou.php">修改/删除信息</a></div></td>
      </tr>
      <tr>
        <td><div align="center"><a href="out.php">退出登陆</a></div></td>
      </tr>
    </table></td>
    <td width="712"><table width="570" height="42" border="1" cellpadding="0" cellspacing="0">
      <tr>
        <td><span class="STYLE1">ID</span></td>
        <td><span class="STYLE1">采摘时间</span></td>
        <td><span class="STYLE1">果实要求</span></td>
        <td><span class="STYLE1">储藏方法</span></td>
        <td><span class="STYLE1">储藏时间</span></td>
        <td><span class="STYLE1">储藏工具</span></td>
        <td><span class="STYLE1">运输要求</span></td>
        <td><span class="STYLE1">质量要求</span></td>
        <td><span class="STYLE1">包装方法</span></td>
      </tr>
      <?php do { ?>
        <tr>
            <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_id']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_time']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_fruit_require']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_store_method']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_store_time']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_store_tool']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_trans_require']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_fruit_standard']; ?></span></td>
          <td><span class="STYLE1"><?php echo $row_pickRecordset1['pick_pack']; ?></span></td>
        </tr>
        <?php } while ($row_pickRecordset1 = mysql_fetch_assoc($pickRecordset1)); ?>
    </table>
      <table border="0" width="50%" align="center">
        <tr>
          <td width="23%" align="center"><?php if ($pageNum_pickRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_pickRecordset1=%d%s", $currentPage, 0, $queryString_pickRecordset1); ?>">第一页</a>
                <?php } // Show if not first page ?>
          </td>
          <td width="31%" align="center"><?php if ($pageNum_pickRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_pickRecordset1=%d%s", $currentPage, max(0, $pageNum_pickRecordset1 - 1), $queryString_pickRecordset1); ?>">上一页</a>
                <?php } // Show if not first page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_pickRecordset1 < $totalPages_pickRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_pickRecordset1=%d%s", $currentPage, min($totalPages_pickRecordset1, $pageNum_pickRecordset1 + 1), $queryString_pickRecordset1); ?>">下一页</a>
                <?php } // Show if not last page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_pickRecordset1 < $totalPages_pickRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_pickRecordset1=%d%s", $currentPage, $totalPages_pickRecordset1, $queryString_pickRecordset1); ?>">尾页</a>
                <?php } // Show if not last page ?>
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<?php
mysql_free_result($pickRecordset1);
?>
